﻿//Created by Action Script Viewer - http://www.buraks.com/asv
package Display.GateUI {
    import flash.events.*;
    import flash.display.*;
    import org.aswing.*;
    import Classes.*;
    import Display.*;
    import flash.text.*;
    import org.aswing.border.*;
    import org.aswing.ext.*;
    import Display.aswingui.*;

    public class CrewGateDialog extends GateDialog {

        protected var m_dialogText:Component;
        protected var m_instructions:String;

        public function CrewGateDialog(_arg1:String, _arg2:Array, _arg3:GridListCellFactory, _arg4:String, _arg5:String, _arg6:Function, _arg7:Function, _arg8:int=3, _arg9:Number=395, _arg10:Boolean=true){
            this.m_instructions = _arg1;
            super(_arg2, _arg3, _arg4, _arg5, _arg6, _arg7, null, _arg8, 615, _arg9, _arg10);
        }
        override protected function onFinishClick(_arg1:Event):void{
            if (m_finishCheckCB()){
                countDialogAction("FINISH");
            } else {
                countDialogAction("ASK");
            };
            m_finishCB();
        }
        protected function createDialogText():Component{
            var _local1:Container;
            var _local2:Component;
            if (this.m_instructions){
                _local1 = new JPanel(new FlowLayout(FlowLayout.CENTER));
                _local2 = ASwingHelper.makeMultilineText(this.m_instructions, 500, EmbeddedArt.DEFAULT_FONT_NAME_BOLD, TextFormatAlign.CENTER, 18, EmbeddedArt.brownTextColor);
                _local1.append(_local2);
            };
            return (_local1);
        }
        override protected function createButtonPanel():Container{
            var _local2:EmptyBorder;
            var _local3:AssetIcon;
            var _local1:Container = new JPanel(new SoftBoxLayout(SoftBoxLayout.X_AXIS, 10, SoftBoxLayout.CENTER));
            if (m_finishCheckCB()){
                m_finishButton = new CustomButton(ZLoc.t("Dialogs", "FinishBuilding").toUpperCase(), null, "GreenButtonUI");
                m_finishButton.setEnabled(m_canBeFinished);
                m_finishButton.addActionListener(this.onFinishClick, 0, true);
            } else {
                _local3 = new AssetIcon((new EmbeddedArt.icon_cash_big() as DisplayObject));
                m_finishButton = new CustomButton(ZLoc.t("Dialogs", "HireFriendsButtonLabel").toUpperCase(), null, "GreenButtonUI");
                m_finishButton.addActionListener(this.onFinishClick, 0, true);
                _local2 = new EmptyBorder(null, new Insets(0, 0, 0, 0));
            };
            _local1.append(m_finishButton);
            if (_local2){
                _local1.setBorder(_local2);
            };
            ASwingHelper.prepare(m_buttonPanel);
            return (_local1);
        }
        override protected function layoutComponents():void{
            var _local1:DisplayObject = (new (assets["buildables_bg"])() as DisplayObject);
            var _local2:MarginBackground = new MarginBackground(_local1, new Insets(0, 0, 10, 0));
            m_jpanel.setBackgroundDecorator(_local2);
            m_jpanel.append(m_headerPanel);
            if (this.m_dialogText){
                m_jpanel.append(this.m_dialogText);
            };
            m_jpanel.appendAll(ASwingHelper.verticalStrut(-18), m_listPanel);
            m_jpanel.append(m_buttonPanel);
        }
        override protected function createListPanel():Component{
            var _local1:Container = new JPanel(new FlowLayout(FlowLayout.CENTER));
            m_list = createList();
            _local1.append(m_list);
            return (_local1);
        }
        override protected function createTitle():Component{
            var _local1:Number = TextFieldUtil.getLocaleFontSize(30, 23, null);
            var _local2:JTextField = ASwingHelper.makeTextField(m_title, EmbeddedArt.TITLE_FONT, _local1, EmbeddedArt.titleColor);
            _local2.filters = EmbeddedArt.titleFilters;
            var _local3:TextFormat = new TextFormat();
            _local3.size = (_local1 + 6);
            TextFieldUtil.formatSmallCaps(_local2.getTextField(), _local3);
            _local2.getTextField().height = 45;
            return (_local2);
        }
        override public function activateFinishButton():void{
            m_canBeFinished = true;
            m_buttonPanel.remove(m_finishButton);
            this.createButtonPanel();
            m_buttonPanel.append(m_finishButton);
            ASwingHelper.prepare(m_buttonPanel);
        }
        override protected function createDialog():void{
            this.m_dialogText = this.createDialogText();
            super.createDialog();
        }

    }
}//package Display.GateUI 
